home *** CD-ROM | disk | FTP | other *** search
/ Inter.Net 55-1 / Inter.Net 55-1.iso / CBuilder / Setup / BCB / data.z / excpt.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-02-09  |  4.9 KB  |  186 lines

  1. /***
  2. *excpt.h - defines exception values, types and routines
  3. *
  4. *Purpose:
  5. *   This file contains the definitions and prototypes for the compiler-
  6. *   dependent intrinsics, support functions and keywords which implement
  7. *   the structured exception handling extensions.
  8. *
  9. ****/
  10.  
  11. /*
  12.  *      C/C++ Run Time Library - Version 9.0
  13.  *
  14.  *      Copyright (c) 1990, 1998 by Borland International
  15.  *      All Rights Reserved.
  16.  *
  17.  */
  18.  
  19.  
  20.  
  21. #ifndef __EXCPT_H
  22. #define __EXCPT_H
  23. #pragma option push -b
  24.  
  25.  
  26. #ifdef __cplusplus
  27. extern "C" {
  28. #endif
  29.  
  30. /*
  31.  * Conditional macro definition for function calling type and variable type
  32.  * qualifiers.
  33.  */
  34. #if   ( (_MSC_VER >= 800) && (_M_IX86 >= 300) ) || defined(__BORLANDC__)
  35.  
  36. /* From WINNT.H */
  37. #define EXCEPTION_CONTINUABLE        0      // Continuable exception
  38. #define EXCEPTION_NONCONTINUABLE     0x1    // Noncontinuable exception
  39. #define EXCEPTION_MAXIMUM_PARAMETERS 15     // maximum number of exception parameters
  40.  
  41. /*
  42.  * Definitions for MS C8-32 (386/486) compiler
  43.  */
  44. #define _CRTAPI1 __cdecl
  45. #define _CRTAPI2 __cdecl
  46.  
  47. #else
  48.  
  49. /*
  50.  * Other compilers (e.g., MIPS)
  51.  */
  52. #define _CRTAPI1
  53. #define _CRTAPI2
  54.  
  55. #endif
  56.  
  57.  
  58. /*
  59.  * Exception disposition return values.
  60.  */
  61. typedef enum _EXCEPTION_DISPOSITION {
  62.     ExceptionContinueExecution,
  63.     ExceptionContinueSearch,
  64.     ExceptionNestedException,
  65.     ExceptionCollidedUnwind
  66. } EXCEPTION_DISPOSITION;
  67.  
  68.  
  69. /*
  70.  * Prototype for SEH support function.
  71.  */
  72.  
  73. #if defined(_M_IX86)
  74.  
  75. /*
  76.  * Declarations to keep MS C 8 (386/486) compiler happy
  77.  */
  78. struct _EXCEPTION_RECORD;
  79. struct _CONTEXT;
  80.  
  81. EXCEPTION_DISPOSITION _CRTAPI2 _except_handler (
  82.         struct _EXCEPTION_RECORD *ExceptionRecord,
  83.         void *EstablisherFrame,
  84.         struct _CONTEXT *ContextRecord,
  85.         void *DispatcherContext
  86.         );
  87.  
  88. #elif defined(_M_MRX000) || defined(_MIPS_) || defined(_ALPHA_)
  89.  
  90. /*
  91.  * Declarations to keep MIPS and ALPHA compiler happy
  92.  */
  93. typedef struct _EXCEPTION_POINTERS *Exception_info_ptr;
  94. struct _EXCEPTION_RECORD;
  95. struct _CONTEXT;
  96. struct _DISPATCHER_CONTEXT;
  97.  
  98.  
  99. EXCEPTION_DISPOSITION __C_specific_handler (
  100.         struct _EXCEPTION_RECORD *ExceptionRecord,
  101.         void *EstablisherFrame,
  102.         struct _CONTEXT *ContextRecord,
  103.         struct _DISPATCHER_CONTEXT *DispatcherContext
  104.         );
  105.  
  106. #endif
  107.  
  108.  
  109. /*
  110.  * Keywords and intrinsics for SEH
  111.  */
  112.  
  113. #if defined(__BORLANDC__)
  114. /*
  115.  * Borland C++
  116.  */
  117. #ifndef __cplusplus
  118. #  define try                       __try
  119. #  define finally                   __finally
  120. #  define AbnormalTermination()     __abnormal_termination
  121. #  define abnormal_termination()    __abnormal_termination
  122. #endif
  123. #define except                      __except
  124.  
  125. #  define GetExceptionCode()        __exception_code
  126. #  define exception_code()          __exception_code
  127. #  define GetExceptionInformation() ((PEXCEPTION_POINTERS)__exception_info)
  128. #  define exception_info()          ((PEXCEPTION_POINTERS)__exception_info)
  129.  
  130. #elif     ( _MSC_VER >= 800 )
  131. /*
  132.  * MS C8-32 (386/486)
  133.  */
  134. #define try                             __try
  135. #define except                          __except
  136. #define finally                         __finally
  137. #define leave                           __leave
  138. #define GetExceptionCode                _exception_code
  139. #define exception_code                  _exception_code
  140. #define GetExceptionInformation         (struct _EXCEPTION_POINTERS *)_exception_info
  141. #define exception_info                  (struct _EXCEPTION_POINTERS *)_exception_info
  142. #define AbnormalTermination             _abnormal_termination
  143. #define abnormal_termination            _abnormal_termination
  144.  
  145. unsigned long _CRTAPI1 _exception_code(void);
  146. void *        _CRTAPI1 _exception_info(void);
  147. int           _CRTAPI1 _abnormal_termination(void);
  148.  
  149. #elif defined(_M_MRX000) || defined(_MIPS_) || defined(_ALPHA_)
  150. /*
  151.  * MIPS or ALPHA compiler
  152.  */
  153. #define try                             __builtin_try
  154. #define except                          __builtin_except
  155. #define finally                         __builtin_finally
  156. #define leave                           __builtin_leave
  157. #define GetExceptionCode()              __exception_code
  158. #define exception_code()                __exception_code
  159. #define GetExceptionInformation()       (struct _EXCEPTION_POINTERS *)__exception_info
  160. #define exception_info()                (struct _EXCEPTION_POINTERS *)__exception_info
  161. #define AbnormalTermination()           __abnormal_termination
  162. #define abnormal_termination()          __abnormal_termination
  163.  
  164. extern unsigned long __exception_code;
  165. extern int           __exception_info;
  166. extern int           __abnormal_termination;
  167.  
  168. #endif
  169.  
  170.  
  171. /*
  172.  * Legal values for expression in except().
  173.  */
  174.  
  175. #define EXCEPTION_EXECUTE_HANDLER        1
  176. #define EXCEPTION_CONTINUE_SEARCH        0
  177. #define EXCEPTION_CONTINUE_EXECUTION    -1
  178.  
  179. #ifdef __cplusplus
  180. }
  181. #endif
  182.  
  183.  
  184. #pragma option pop
  185. #endif  /* __EXCPT_H */
  186.